<?php
namespace app\controller;

use app\BaseController;
use app\model\SysUser;
use think\facade\View;

/**
 * 品牌特展
 */
class Brand extends BaseController
{
    public function index()
    {

        // 行业分类 定义集合 包含 logo 和选中的logo 标题 id 四个字段
        // 食品酒水 纺织服饰 户外体育 医疗美容 健康保健 母婴用品 家居百货 文教办公 交通物流 安保消防 五金建材 工业制造 能源材料 节能环保 信息技术 人工智能
        $industry = [
            ['title' => '食品酒水', 'logo' => '/static/images/icon_hy011.png', 'active_logo' => '/static/images/icon_hy012.png'],
            ['title' => '纺织服饰', 'logo' => '/static/images/icon_hy021.png', 'active_logo' => '/static/images/icon_hy022.png'],
            ['title' => '户外体育', 'logo' => '/static/images/icon_hy031.png', 'active_logo' => '/static/images/icon_hy032.png'],
            ['title' => '医疗美容', 'logo' => '/static/images/icon_hy041.png', 'active_logo' => '/static/images/icon_hy042.png'],
            ['title' => '健康保健', 'logo' => '/static/images/icon_hy051.png', 'active_logo' => '/static/images/icon_hy052.png'],
            ['title' => '母婴用品', 'logo' => '/static/images/icon_hy061.png', 'active_logo' => '/static/images/icon_hy062.png'],
            ['title' => '家居百货', 'logo' => '/static/images/icon_hy071.png', 'active_logo' => '/static/images/icon_hy072.png'],
            ['title' => '文教办公', 'logo' => '/static/images/icon_hy081.png', 'active_logo' => '/static/images/icon_hy082.png'],
            ['title' => '交通物流', 'logo' => '/static/images/icon_hy091.png', 'active_logo' => '/static/images/icon_hy092.png'],
            ['title' => '安保消防', 'logo' => '/static/images/icon_hy101.png', 'active_logo' => '/static/images/icon_hy102.png'],
            ['title' => '五金建材', 'logo' => '/static/images/icon_hy111.png', 'active_logo' => '/static/images/icon_hy112.png'],
            ['title' => '工业制造', 'logo' => '/static/images/icon_hy121.png', 'active_logo' => '/static/images/icon_hy122.png'],
            ['title' => '能源材料', 'logo' => '/static/images/icon_hy131.png', 'active_logo' => '/static/images/icon_hy132.png'],
            ['title' => '节能环保', 'logo' => '/static/images/icon_hy141.png', 'active_logo' => '/static/images/icon_hy142.png'],
            ['title' => '信息技术', 'logo' => '/static/images/icon_hy151.png', 'active_logo' => '/static/images/icon_hy152.png'],
            ['title' => '人工智能', 'logo' => '/static/images/icon_hy161.png', 'active_logo' => '/static/images/icon_hy162.png'],
        ];

        // 返回页面
        View::assign('industry', $industry);


        // 推荐的八个企业 图片 + 企业名称
        $list = SysUser::where(['deleted' => 0,'status' => 0, 'types' => 2])
            ->order('create_time desc')->paginate(10);
        // 把分页数据赋值给模板变量list
        View::assign('recommend', $list);


        // 推荐资讯 列表 title + 时间
        $news = [
            ['title' => '迈向汽车强国 我国汽车产业在大变局中领“新”续航｜启新.中国工业论坛', 'show_time' => '2021-01-01','id'=> 1],
            ['title' => '迈向汽车强国 我国汽车产业在大变局中领“新”续航｜启新.中国工业论坛', 'show_time' => '2021-01-02','id'=> 2],
            ['title' => '迈向汽车强国 我国汽车产业在大变局中领“新”续航｜启新.中国工业论坛', 'show_time' => '2021-01-03','id'=> 3],
            ['title' => '迈向汽车强国 我国汽车产业在大变局中领“新”续航｜启新.中国工业论坛', 'show_time' => '2021-01-04','id'=> 4],
            ['title' => '迈向汽车强国 我国汽车产业在大变局中领“新”续航｜启新.中国工业论坛', 'show_time' => '2021-01-05','id'=> 5],
        ];
        View::assign('news', $news);

        // 如果是手机访问
        if ($this->isMobile())
        {
            return View::fetch('wap_index');
        } else {
            return View::fetch();
        }
    }


    /**
     * 企业详情
     */
    public function detail($id = null)
    {
        // 推荐的八个企业 图片 + 企业名称
        $recommend = [
            ['title' => '企业1', 'logo' => '/static/images/icon_qy01.png', 'id'=> 1],
            ['title' => '企业2', 'logo' => '/static/images/icon_qy02.png', 'id'=> 1],
            ['title' => '企业3', 'logo' => '/static/images/icon_qy03.png', 'id'=> 1],
            ['title' => '企业4', 'logo' => '/static/images/icon_qy04.png', 'id'=> 1],
            ['title' => '企业5', 'logo' => '/static/images/icon_qy05.png', 'id'=> 1],
            ['title' => '企业6', 'logo' => '/static/images/icon_qy06.png', 'id'=> 1],
            ['title' => '企业7', 'logo' => '/static/images/icon_qy07.png', 'id'=> 1],
//            ['title' => '企业8', 'logo' => '/static/images/icon_qy08.png', 'id'=> 1],
        ];
        View::assign('recommend', $recommend);


        return View::fetch();
    }


}
